<?php
/**
*File Name:function.php
*Date:2016年7月17日下午3:22:24
*Copyright  (c)2016,783188184@qq.com All Rights Reserved
*____________________________________________________________________________________________________
*/
/*
 * 该函数主要用于返回model查询结果的判断
 * 这样在换回结果是就不需要复杂的判断
 * */

function returninfo($res){
	if($res === false){
		return array('status' => false,'info' => $res);
	}else{
		return array('status' => true,'info' => $res);
	}
}

/**
 * apiCall
 * @param $url
 * @param array $vars
 * @param string $layer
 * @return mixed
 */
function apiCall($url, $vars=array(), $layer = 'Api') {
    //TODO:考虑使用func_get_args 获取参数数组

    $ret = R($url, $vars, $layer);
    if($ret === false){
        return array('status'=>false,'info'=>'无法调用'.$url);
    }
    return $ret;
}



function slog($log, $type = '', $user = false){
    if(C('XSOCKET_LOG')===false) return;
    vendor('XSocketlog',APP_PATH.'Weixin/Vendor/XSocketlog/','.class.php');
    if(!$user) $user = C('XSOCKET_LOG_USER');
    $socketlog = new socketlog($user);
    $socketlog->send($log, $type);
}
